LanguageExt.Core

LanguageExt.Core Transducers

Contents

Sub modules

Implementations

class Transducer Source #

Methods

method Transducer<A, B> Tail <A, B> (this Transducer<A, B> recursive) Source #

Wrap this around a tail recursive call to mark it as the end of a recursive expression.

method Transducer<A, B> Use <A, B> (this Transducer<A, B> transducer, Func<B, Unit> dispose) Source #

Resource tracking transducer

method Transducer<A, B> Use <A, B> (this Transducer<A, B> transducer) Source #

where B : IDisposable

Resource tracking transducer

method Transducer<E, B> Apply <E, A, B> ( this Transducer<E, Func<A, B>> ff, Transducer<E, A> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, B> Apply <E, A, B> ( this Transducer<E, Transducer<A, B>> ff, Transducer<E, A> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, Sum<X, B>> Action <E, X, A, B> ( this Transducer<E, Sum<X, A>> fa, Transducer<E, Sum<X, B>> fb) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, Sum<X, B>> Apply <E, X, A, B> ( this Transducer<E, Sum<X, Func<A, B>>> ff, Transducer<E, Sum<X, A>> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, Sum<X, B>> Apply <E, X, A, B> ( this Transducer<E, Sum<X, Transducer<A, B>>> ff, Transducer<E, Sum<X, A>> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<Unit, B> Invoke <A, B> (this Transducer<A, B> f, A value) Source #

Partial application

Parameters

param f

Transducer to partially apply

param value

Value to apply

returns

Constant transducer with the first argument filled

method Transducer<B, C> Invoke <A, B, C> (this Transducer<A, Transducer<B, C>> f, A value) Source #

Partial application

Parameters

param f

Transducer to partially apply

param value

Value to apply

returns

Transducer with the first argument filled

method Transducer<B, C> Invoke <A, B, C> (this Transducer<A, Func<B, C>> f, A value) Source #

Partial application

Parameters

param f

Transducer to partially apply

param value

Value to apply

returns

Transducer with the first argument filled

method Transducer<A, C> Map <A, B, C> (this Transducer<A, B> m, Func<B, C> f) Source #

Maps every value passing through this transducer

method Transducer<E, Sum<X, B>> MapRight <E, X, A, B> (this Transducer<E, Sum<X, A>> m, Func<A, B> f) Source #

Maps every right value passing through this transducer

method Transducer<E, Sum<X, B>> MapRight <E, X, A, B> (this Transducer<E, Sum<X, A>> m, Transducer<A, B> f) Source #

Maps every right value passing through this transducer

method Transducer<E, Sum<Y, A>> MapLeft <E, X, Y, A> (this Transducer<E, Sum<X, A>> m, Func<X, Y> f) Source #

Maps every left value passing through this transducer

method Transducer<E, Sum<Y, A>> MapLeft <E, X, Y, A> (this Transducer<E, Sum<X, A>> m, Transducer<X, Y> f) Source #

Maps every left value passing through this transducer

method Transducer<E, Sum<Y, B>> BiMap <E, X, Y, A, B> ( this Transducer<E, Sum<X, A>> transducer, Func<X, Y> Left, Func<A, B> Right) Source #

Maps every left value passing through this transducer

method Transducer<E, Sum<Y, B>> BiMap <E, X, Y, A, B> ( this Transducer<E, Sum<X, A>> transducer, Transducer<X, Y> Left, Transducer<A, B> Right) Source #

Maps every left value passing through this transducer

method Transducer<A, C> Select <A, B, C> (this Transducer<A, B> m, Func<B, C> g) Source #

Maps every value passing through this transducer

method Transducer<A, B> Flatten <A, B> (this Transducer<A, Transducer<A, B>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<A, B> Flatten <A, B> (this Transducer<A, Transducer<Unit, B>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<Unit, Sum<X, A>> Flatten <X, A> ( this Transducer<Unit, Sum<X, Transducer<Unit, Sum<X, A>>>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<Env, Sum<X, A>> Flatten <Env, X, A> ( this Transducer<Env, Sum<X, Transducer<Env, Sum<X, A>>>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<Env, Sum<X, A>> Flatten <Env, X, A> ( this Transducer<Env, Sum<X, Transducer<Unit, Sum<X, A>>>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<Env, Sum<X, A>> Flatten <Env, X, A> ( this Transducer<Env, Sum<Transducer<Env, Sum<X, A>>, Transducer<Env, Sum<X, A>>>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<A, C> Bind <A, B, C> (this Transducer<A, B> m, Func<B, Transducer<A, C>> g) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<A, C> Bind <A, B, C> (this Transducer<Unit, B> m, Func<B, Transducer<A, C>> g) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<A, C> Bind <A, B, C> (this Transducer<A, B> m, Transducer<B, Transducer<A, C>> g) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<A, C> Bind <A, B, C> (this Transducer<Unit, B> m, Transducer<B, Transducer<A, C>> g) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, Unit>> Bind <E, X, A> (this Transducer<E, A> ma, Transducer<A, Guard<X, Unit>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, Unit>> Bind <E, X, A> (this Transducer<E, A> ma, Func<A, Guard<X, Unit>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<E, Sum<X, A>> ma, Transducer<A, Transducer<E, Sum<X, B>>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<Unit, Sum<X, A>> ma, Transducer<A, Transducer<E, Sum<X, B>>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<E, Sum<X, A>> ma, Func<A, Transducer<E, Sum<X, B>>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<Unit, Sum<X, A>> ma, Func<A, Transducer<E, Sum<X, B>>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<E, Sum<X, A>> ma, Transducer<A, Transducer<E, B>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<Unit, Sum<X, A>> ma, Transducer<A, Transducer<E, B>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<E, Sum<X, A>> ma, Func<A, Transducer<E, B>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, B>> BindSum <E, X, A, B> (this Transducer<Unit, Sum<X, A>> ma, Func<A, Transducer<E, B>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, Unit>> BindSum <E, X, A> (this Transducer<E, Sum<X, A>> ma, Transducer<A, Guard<X, Unit>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<Unit, Sum<X, Unit>> BindSum <X, A> (this Transducer<Unit, Sum<X, A>> ma, Transducer<A, Guard<X, Unit>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<E, Sum<X, Unit>> BindSum <E, X, A> (this Transducer<E, Sum<X, A>> ma, Func<A, Guard<X, Unit>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<Unit, Sum<X, Unit>> BindSum <X, A> (this Transducer<Unit, Sum<X, A>> ma, Func<A, Guard<X, Unit>> f) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<A, D> SelectMany <A, B, C, D> ( this Transducer<A, B> ma, Func<B, Transducer<A, C>> bind, Func<B, C, D> project) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<A, Sum<X, C>> SelectMany <X, A, B, C> ( this Transducer<A, B> ma, Func<B, Guard<X, Unit>> bind, Func<B, Unit, C> project) Source #

Projects every value into the monadic bind function provided.

Parameters

returns

Monadic bound transducer

method Transducer<A, B> Filter <A, B> (this Transducer<A, B> f, Transducer<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, B> Filter <A, B> (this Transducer<A, B> f, Func<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, Sum<X, B>> Filter <X, A, B> (this Transducer<A, Sum<X, B>> f, Transducer<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, Sum<X, B>> Filter <X, A, B> (this Transducer<A, Sum<X, B>> f, Func<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, B> Ignore <A, B> (this Transducer<Unit, B> m) Source #

Lifts a unit accepting transducer, ignores the input value.

method Transducer<A, B> MemoStream <A, B> (this Transducer<A, B> transducer) Source #

Caches the result of the transducer computation for each value flowing through.

This works within the context of a single Invoke operation, so it only makes sense if you're using the transducer as part of a stream process. This allows each item coming through to have its result cached. So you never repeat the process for each A value.

NOTE: Transducers use both a value and a state as inputs to its transformation and reduce process. For memoisation the state is ignored. In a non-memoisation scenario a different state and value pair could produce different results; and so this should be considered when deciding to apply a memo to a transducer: it only checks value equality.

Parameters

param transducer

Transducer to memoise

returns

Memoised transducer

method Transducer<A, B> MemoStream <EqA, A, B> (this Transducer<A, B> transducer) Source #

where EqA : Eq<A>

Caches the result of the transducer computation for each value flowing through.

This works within the context of a single Invoke operation, so it only makes sense if you're using the transducer as part of a stream process. This allows each item coming through to have its result cached. So you never repeat the process for each A value.

NOTE: Transducers use both a value and a state as inputs to its transformation and reduce process. For memoisation the state is ignored. In a non-memoisation scenario a different state and value pair could produce different results; and so this should be considered when deciding to apply a memo to a transducer: it only checks value equality.

Parameters

param transducer

Transducer to memoise

returns

Memoised transducer

method Transducer<A, B> Memo <A, B> (this Transducer<A, B> transducer) Source #

Caches the result of the transducer computation for each value flowing through.

Unlike MemoStream - which only caches values for the duration of the the call to Invoke - this caches values for the duration of the life of the Transducer instance.

NOTE: Transducers use both a value and a state as inputs to its transformation and reduce process. For memoisation the state is ignored. In a non-memoisation scenario a different state and value pair could produce different results; and so this should be considered when deciding to apply a memo to a transducer: it only checks value equality.

Parameters

param transducer

Transducer to memoise

returns

Memoised transducer

method Transducer<A, B> Memo <EqA, A, B> (this Transducer<A, B> transducer) Source #

where EqA : Eq<A>

Caches the result of the transducer computation for each value flowing through.

Unlike MemoStream - which only caches values for the duration of the the call to Invoke - this caches values for the duration of the life of the Transducer instance.

NOTE: Transducers use both a value and a state as inputs to its transformation and reduce process. For memoisation the state is ignored. In a non-memoisation scenario a different state and value pair could produce different results; and so this should be considered when deciding to apply a memo to a transducer: it only checks value equality.

Parameters

param transducer

Transducer to memoise

returns

Memoised transducer

method Transducer<E, (A First, B Second)> Zip <E, A, B> ( this Transducer<E, A> First, Transducer<E, B> Second) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

returns

A transducer that contains the results of both provided

method Transducer<E, Sum<X, (A First, B Second)>> Zip <E, X, A, B> ( this Transducer<E, Sum<X, A>> First, Transducer<E, Sum<X, B>> Second) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

returns

A transducer that contains the results of both provided

method Transducer<E, (A First, B Second, C Third)> Zip <E, A, B, C> ( this Transducer<E, A> First, Transducer<E, B> Second, Transducer<E, C> Third) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

param Third

Third transducer

returns

A transducer that contains the results of all provided

method Transducer<E, Sum<X, (A First, B Second, C Third)>> Zip <E, X, A, B, C> ( this Transducer<E, Sum<X, A>> First, Transducer<E, Sum<X, B>> Second, Transducer<E, Sum<X, C>> Third) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

param Third

Third transducer

returns

A transducer that contains the results of all provided

method Transducer<A, TFork<B>> Fork <A, B> ( this Transducer<A, B> transducer, Option<TimeSpan> timeout = default) Source #

Create a transducer that is queued to run on the thread-pool.

Parameters

param transducer

Transducer to fork

param timeout

Maximum time that the forked transducer can run for. None for no timeout.

returns

Returns a TFork data-structure that contains two transducers that can be used to either cancel the forked transducer or to await the result of it.

method Transducer<A, TFork<S>> Fork <S, A, B> ( this Transducer<A, B> transducer, S initialState, Reducer<B, S> reducer, Option<TimeSpan> timeout = default) Source #

Create a transducer that is queued to run on the thread-pool.

Parameters

param transducer

Transducer to fork

param timeout

Maximum time that the forked transducer can run for. None for no timeout.

returns

Returns a TFork data-structure that contains two transducers that can be used to either cancel the forked transducer or to await the result of it.

method Transducer<A, B> Retry <A, B> ( this Transducer<A, B> transducer, Schedule schedule) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<A, B> RetryUntil <A, B> ( this Transducer<A, B> transducer, Schedule schedule, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<A, B> RetryWhile <A, B> ( this Transducer<A, B> transducer, Schedule schedule, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns false then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> Retry <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Schedule schedule) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> RetryUntil <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Schedule schedule, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> RetryWhile <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Schedule schedule, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that retries

method Transducer<A, B> Retry <A, B> ( this Transducer<A, B> transducer) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<A, B> RetryUntil <A, B> ( this Transducer<A, B> transducer, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<A, B> RetryWhile <A, B> ( this Transducer<A, B> transducer, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns false then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> Retry <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> RetryUntil <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> RetryWhile <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that retries

method Transducer<A, B> Repeat <A, B> ( this Transducer<A, B> transducer, Schedule schedule) Source #

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

returns

A transducer that repeats

returns

A transducer that repeats

method Transducer<A, B> RepeatUntil <A, B> ( this Transducer<A, B> transducer, Schedule schedule, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> RepeatWhile <A, B> ( this Transducer<A, B> transducer, Schedule schedule, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> Repeat <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Schedule schedule) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

returns

A transducer that retries

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> RepeatUntil <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Schedule schedule, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> RepeatWhile <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Schedule schedule, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> Repeat <A, B> ( this Transducer<A, B> transducer) Source #

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

returns

A transducer that repeats

returns

A transducer that repeats

method Transducer<A, B> RepeatUntil <A, B> ( this Transducer<A, B> transducer, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> RepeatWhile <A, B> ( this Transducer<A, B> transducer, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> Repeat <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

returns

A transducer that retries

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> RepeatUntil <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> RepeatWhile <RT, X, A> ( this Transducer<RT, Sum<X, A>> transducer, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method TResult<S> Run <S, A, B> ( this Transducer<A, B> transducer, A value, S initialState, Reducer<B, S> reducer, CancellationToken token = default, SynchronizationContext? syncContext = null) Source #

Invoke the transducer, transforming the input value and finally reducing the output with the Reducer provided

Parameters

param transducer

Transducer to invoke

param value

Value to use as the argument to the transducer

param initialState

Starting state

param reducer

Value to use as the argument to the transducer

returns

If the transducer yields multiple values then it will return the last value in a TResult.Complete. If the transducer yields zero values then it will return TResult.None. If the transducer throws an exception or yields an Error, then it will return TResult.Fail. If the transducer is cancelled, then it will return TResult.Cancelled.

method TResult<B> Run1 <A, B> ( this Transducer<A, B> transducer, A value, CancellationToken token = default, SynchronizationContext? syncContext = null) Source #

Invoke the transducer, reducing to a single value only

Parameters

param transducer

Transducer to invoke

param value

Value to use as the argument to the transducer

returns

If the transducer yields multiple values then it will return the last value in a TResult.Complete. If the transducer yields zero values then it will return TResult.None. If the transducer throws an exception or yields an Error, then it will return TResult.Fail. If the transducer is cancelled, then it will return TResult.Cancelled.

method Task<TResult<S>> RunAsync <S, A, B> ( this Transducer<A, B> transducer, A value, S initialState, Reducer<B, S> reducer, Action? @finally, CancellationToken token = default, SynchronizationContext? syncContext = null) Source #

Invoke the transducer, transforming the input value and finally reducing the output with the Reducer provided

Parameters

param transducer

Transducer to invoke

param value

Value to use as the argument to the transducer

param initialState

Starting state

param reducer

Value to use as the argument to the transducer

returns

If the transducer yields multiple values then it will return the last value in a TResult.Complete. If the transducer yields zero values then it will return TResult.None. If the transducer throws an exception or yields an Error, then it will return TResult.Fail. If the transducer is cancelled, then it will return TResult.Cancelled.

method Task<TResult<B>> Run1Async <A, B> ( this Transducer<A, B> transducer, A value, Action? @finally, CancellationToken token = default, SynchronizationContext? syncContext = null) Source #

Invoke the transducer, reducing to a single value only

Parameters

param transducer

Transducer to invoke

param value

Value to use as the argument to the transducer

returns

If the transducer yields multiple values then it will return the last value in a TResult.Complete. If the transducer yields zero values then it will return TResult.None. If the transducer throws an exception or yields an Error, then it will return TResult.Fail. If the transducer is cancelled, then it will return TResult.Cancelled.

class Transducer Source #

Methods

method Transducer<Unit, A> pure <A> (A value) Source #

Lift a value into the Transducer space

Parameters

type A

Value type

param value

Value to lift

returns

Transducer from Unit to A

method Transducer<A, B> fail <A, B> (Error error) Source #

Fail transducer

Consider this the throw of transducers. It is the nuclear option to get out of a reduce.

Parameters

param error

Error to raise

returns

A transducer that always fails

method Transducer<A, B> constant <A, B> (B value) Source #

Constant transducer

Takes any value, ignores it and yields the value provided.

Parameters

type A

Input value type

type B

Constant value type

param value

Constant value to yield

returns

Transducer from A to B

method Transducer<A, B> ignore <A, B> (Transducer<Unit, B> m) Source #

Lifts a unit accepting transducer, ignores the input value.

method Transducer<A, (A, A)> mkPair <A> () Source #

Make a tuple from a value

method Transducer<A, Sum<X, A>> mkRight <X, A> () Source #

Make a Sum.Right from a value

method Transducer<X, Sum<X, A>> mkLeft <X, A> () Source #

Make a Sum.Left from a value

method Transducer<A, B> tail <A, B> (Transducer<A, B> recursive) Source #

Wrap this around a tail recursive call to mark it as the end of a recursive expression.

method Transducer<Unit, Unit> lift (Action action0) Source #

Lift a function into a Transducer

Parameters

param action0

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Unit> lift <A> (Action<A> action1) Source #

Lift a function into a Transducer

Parameters

param action1

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, A> lift <A> (Func<A> function0) Source #

Lift a function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, A> lift <A> (Func<TResult<A>> tfunction0) Source #

Lift a function into a Transducer

Parameters

param tfunction0

Function

returns

Transducer that wraps the lifted function

method Transducer<A, B> lift <A, B> (Func<A, B> function1) Source #

Lift a function into a Transducer

Parameters

param function1

Function

returns

Transducer that wraps the lifted function

method Transducer<A, B> lift <A, B> (Func<A, TResult<B>> tfunction1) Source #

Lift a function into a Transducer

Parameters

param tfunction1

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Transducer<B, C>> lift <A, B, C> ( Func<A, B, C> function2) Source #

Lift a function into a Transducer

Parameters

param function2

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Transducer<B, C>> lift <A, B, C> ( Func<A, B, TResult<C>> tfunction2) Source #

Lift a function into a Transducer

Parameters

param tfunction2

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Transducer<B, Transducer<C, D>>> lift <A, B, C, D> ( Func<A, B, C, D> function3) Source #

Lift a function into a Transducer

Parameters

param function3

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Transducer<B, Transducer<C, D>>> lift <A, B, C, D> ( Func<A, B, C, TResult<D>> tfunction3) Source #

Lift a function into a Transducer

Parameters

param tfunction3

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Transducer<B, Transducer<C, Transducer<D, E>>>> lift <A, B, C, D, E> ( Func<A, B, C, D, E> function4) Source #

Lift a function into a Transducer

Parameters

param function4

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Transducer<B, Transducer<C, Transducer<D, E>>>> lift <A, B, C, D, E> ( Func<A, B, C, D, TResult<E>> tfunction4) Source #

Lift a function into a Transducer

Parameters

param tfunction4

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, Unit> liftAsync (Func<Task> action0) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Unit> liftAsync <A> (Func<A, Task> action1) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, A> liftAsync <A> (Func<Task<A>> function0) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, A> liftAsync <A> (Func<Task<TResult<A>>> tfunction0) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param tfunction0

Function

returns

Transducer that wraps the lifted function

method Transducer<A, B> liftAsync <A, B> (Func<A, Task<B>> function1) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function1

Function

returns

Transducer that wraps the lifted function

method Transducer<A, B> liftAsync <A, B> (Func<A, Task<TResult<B>>> tfunction1) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param tfunction1

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, Unit> liftAsync (Func<CancellationToken, Task> action0) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<A, Unit> liftAsync <A> (Func<CancellationToken, A, Task> action1) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, A> liftAsync <A> (Func<CancellationToken, Task<A>> function0) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function0

Function

returns

Transducer that wraps the lifted function

method Transducer<Unit, A> liftAsync <A> (Func<CancellationToken, Task<TResult<A>>> tfunction0) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param tfunction0

Function

returns

Transducer that wraps the lifted function

method Transducer<A, B> liftAsync <A, B> (Func<CancellationToken, A, Task<B>> function1) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param function1

Function

returns

Transducer that wraps the lifted function

method Transducer<A, B> liftAsync <A, B> (Func<CancellationToken, A, Task<TResult<B>>> tfunction1) Source #

Lift a asynchronous IO function into a Transducer

Parameters

param tfunction1

Function

returns

Transducer that wraps the lifted function

method Transducer<Guard<E, Unit>, Sum<E, Unit>> guard <E> () Source #

Guard transducer

method Transducer<Guard<E, A>, Sum<E, Unit>> guard <E, A> () Source #

Guard transducer

method Transducer<IEnumerable<A>, A> enumerable <A> () Source #

Stream the items in the enumerable through the transducer

Parameters

type A

Bound value type

param items

Items to stream

returns

Transducer that represents the stream

method Transducer<IObservable<A>, A> observable <A> () Source #

Stream the items in the enumerable through the transducer

Parameters

type A

Bound value type

param items

Items to stream

returns

Transducer that represents the stream

method Transducer<Seq<A>, A> seq <A> () Source #

Stream the items in the Seq through the transducer

Parameters

type A

Bound value type

param items

Items to stream

returns

Transducer that represents the stream

method Transducer<IAsyncEnumerable<A>, A> asyncEnumerable <A> () Source #

Stream the items in the IAsyncEnumerable through the transducer

Parameters

type A

Bound value type

param items

Items to stream

returns

Transducer that represents the stream

method Transducer<A, A> identity <A> () Source #

Identity transducer

method Transducer<A, C> compose <A, B, C> ( Transducer<A, B> f, Transducer<B, C> g) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, D> compose <A, B, C, D> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, E> compose <A, B, C, D, E> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h, Transducer<D, E> i) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, F> compose <A, B, C, D, E, F> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h, Transducer<D, E> i, Transducer<E, F> j) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, G> compose <A, B, C, D, E, F, G> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h, Transducer<D, E> i, Transducer<E, F> j, Transducer<F, G> k) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, H> compose <A, B, C, D, E, F, G, H> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h, Transducer<D, E> i, Transducer<E, F> j, Transducer<F, G> k, Transducer<G, H> l) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, I> compose <A, B, C, D, E, F, G, H, I> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h, Transducer<D, E> i, Transducer<E, F> j, Transducer<F, G> k, Transducer<G, H> l, Transducer<H, I> m) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<A, J> compose <A, B, C, D, E, F, G, H, I, J> ( Transducer<A, B> f, Transducer<B, C> g, Transducer<C, D> h, Transducer<D, E> i, Transducer<E, F> j, Transducer<F, G> k, Transducer<G, H> l, Transducer<H, I> m, Transducer<I, J> n) Source #

Transducer composition. The output of one transducer is fed as the input to the next.

Resulting im a single transducer that captures the composition

Parameters

returns

Transducer that captures the composition

method Transducer<E, B> apply <E, A, B> ( Transducer<E, Func<A, B>> ff, Transducer<E, A> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, B> apply <E, A, B> ( Transducer<E, Transducer<A, B>> ff, Transducer<E, A> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, Sum<X, B>> apply <E, X, A, B> ( Transducer<E, Sum<X, Func<A, B>>> ff, Transducer<E, Sum<X, A>> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<E, Sum<X, B>> apply <E, X, A, B> ( Transducer<E, Sum<X, Transducer<A, B>>> ff, Transducer<E, Sum<X, A>> fa) Source #

Applicative apply

Gets a lifted function and a lifted argument, invokes the function with the argument and re-lifts the result.

Parameters

returns

Result of applying the function to the argument

method Transducer<Sum<X, A>, Sum<Y, B>> bimap <X, Y, A, B> ( Transducer<X, Y> Left, Transducer<A, B> Right) Source #

Functor bi-map

Parameters

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<(X, A), (Y, B)> bimapPair <X, Y, A, B> ( Transducer<X, Y> Left, Transducer<A, B> Right) Source #

Functor bi-map

Parameters

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<Sum<X, A>, Sum<Y, B>> bimap <X, Y, A, B> ( Func<X, Y> Left, Func<A, B> Right) Source #

Functor bi-map

Parameters

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<(X, A), (Y, B)> bimapPair <X, Y, A, B> ( Func<X, Y> Left, Func<A, B> Right) Source #

Functor bi-map

Parameters

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<E, Sum<Y, B>> bimap <E, X, Y, A, B> ( Transducer<E, Sum<X, A>> First, Transducer<X, Y> Left, Transducer<A, B> Right) Source #

Functor bi-map

Parameters

param First

First transducer to run

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<E, Sum<Y, B>> bimap <E, X, Y, A, B> ( Transducer<E, Sum<X, A>> First, Func<X, Y> Left, Func<A, B> Right) Source #

Functor bi-map

Parameters

param First

First transducer to run

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<Sum<X, A>, Sum<Z, C>> bimap <X, Y, Z, A, B, C> ( Transducer<Sum<X, A>, Sum<Y, B>> First, Transducer<Y, Z> Left, Transducer<B, C> Right) Source #

Functor bi-map

Parameters

param First

First transducer to run

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<Sum<X, A>, Sum<Z, C>> bimap <X, Y, Z, A, B, C> ( Transducer<Sum<X, A>, Sum<Y, B>> First, Func<Y, Z> Left, Func<B, C> Right) Source #

Functor bi-map

Parameters

param First

First transducer to run

param Left

Left mapping transducer

param Right

Right mapping transducer

returns

Composition of first, left, and right transducers

method Transducer<Sum<X, A>, Sum<Y, A>> mapLeft <X, Y, A> ( Transducer<X, Y> Left) Source #

Functor bi-map map left

Parameters

param First

First transducer to run

param Left

Left mapping transducer

returns

Composition of first and left transducers

method Transducer<Sum<X, A>, Sum<Y, A>> mapLeft <X, Y, A> ( Func<X, Y> Left) Source #

Functor bi-map map left

Parameters

param First

First transducer to run

param Left

Left mapping transducer

returns

Composition of first and left transducers

method Transducer<E, Sum<Y, A>> mapLeft <E, X, Y, A> ( Transducer<E, Sum<X, A>> First, Transducer<X, Y> Left) Source #

Functor bi-map map left

Parameters

param First

First transducer to run

param Left

Left mapping transducer

returns

Composition of first and left transducers

method Transducer<E, Sum<Y, A>> mapLeft <E, X, Y, A> ( Transducer<E, Sum<X, A>> First, Func<X, Y> Left) Source #

Functor bi-map map left

Parameters

param First

First transducer to run

param Left

Left mapping transducer

returns

Composition of first and left transducers

method Transducer<Sum<X, A>, Sum<Z, B>> mapLeft <X, Y, Z, A, B> ( Transducer<Sum<X, A>, Sum<Y, B>> First, Transducer<Y, Z> Left) Source #

Functor bi-map map left

Parameters

param First

First transducer to run

param Left

Left mapping transducer

returns

Composition of first and left

method Transducer<Sum<X, A>, Sum<Z, B>> mapLeft <X, Y, Z, A, B> ( Transducer<Sum<X, A>, Sum<Y, B>> First, Func<Y, Z> Left) Source #

Functor bi-map map left

Parameters

param First

First transducer to run

param Left

Left mapping transducer

returns

Composition of first and left

method Transducer<Sum<X, A>, Sum<X, B>> mapRight <X, A, B> ( Transducer<A, B> Right) Source #

Functor bi-map map right

Parameters

param First

First transducer to run

param Right

Right mapping transducer

returns

Composition of first and right transducers

method Transducer<Sum<X, A>, Sum<X, B>> mapRight <X, A, B> ( Func<A, B> Right) Source #

Functor bi-map map right

Parameters

param First

First transducer to run

param Right

Right mapping transducer

returns

Composition of first and right transducers

method Transducer<E, Sum<X, B>> mapRight <E, X, A, B> ( Transducer<E, Sum<X, A>> First, Transducer<A, B> Right) Source #

Functor bi-map map right

Parameters

param First

First transducer to run

param Right

Right mapping transducer

returns

Composition of first and right transducers

method Transducer<E, Sum<X, B>> mapRight <E, X, A, B> ( Transducer<E, Sum<X, A>> First, Func<A, B> Right) Source #

Functor bi-map map right

Parameters

param First

First transducer to run

param Right

Right mapping transducer

returns

Composition of first and right transducers

method Transducer<Sum<X, A>, Sum<Y, C>> mapRight <X, Y, A, B, C> ( Transducer<Sum<X, A>, Sum<Y, B>> First, Transducer<B, C> Right) Source #

Functor bi-map map right

Parameters

param First

First transducer to run

param Right

Right mapping transducer

returns

Composition of first and right transducers

method Transducer<Sum<X, A>, Sum<Y, C>> mapRight <X, Y, A, B, C> ( Transducer<Sum<X, A>, Sum<Y, B>> First, Func<B, C> Right) Source #

Functor bi-map map right

Parameters

param First

First transducer to run

param Right

Right mapping transducer

returns

Composition of first and right transducers

method Transducer<B, C> partial <A, B, C> (Transducer<A, Transducer<B, C>> f, A value) Source #

Partial application

Parameters

param f

Transducer to partially apply

param value

Value to apply

returns

Transducer with the first argument filled

method Transducer<B, C> partial <A, B, C> (Transducer<A, Func<B, C>> f, A value) Source #

Partial application

Parameters

param f

Transducer to partially apply

param value

Value to apply

returns

Transducer with the first argument filled

method Transducer<A, B> flatten <A, B> (Transducer<A, Transducer<A, B>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<A, B> flatten <A, B> (Transducer<A, Transducer<Unit, B>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<Env, Sum<X, A>> flatten <Env, X, A> (Transducer<Env, Sum<X, Transducer<Env, Sum<X, A>>>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<Env, Sum<X, A>> flatten <Env, X, A> ( Transducer<Env, Sum<Transducer<Env, Sum<X, A>>, Transducer<Env, Sum<X, A>>>> ff) Source #

Take nested transducers and flatten them

Parameters

param ff

Nested transducers

returns

Flattened transducers

method Transducer<E, B> bind <E, A, B> ( Transducer<E, A> m, Transducer<A, Transducer<E, B>> f) Source #

Monadic bind

method Transducer<E, B> bind <E, A, B> ( Transducer<E, A> m, Transducer<A, Func<E, B>> f) Source #

Monadic bind

method Transducer<E, B> bind <E, A, B> ( Transducer<E, A> m, Func<A, Transducer<E, B>> f) Source #

Monadic bind

method Transducer<E, Sum<X, B>> bind <E, X, A, B> ( Transducer<E, Sum<X, A>> m, Transducer<A, Transducer<E, Sum<X, B>>> f) Source #

Monadic bind

method Transducer<E, Sum<X, B>> bind <E, X, A, B> ( Transducer<E, Sum<X, A>> m, Func<A, Transducer<E, Sum<X, B>>> f) Source #

Monadic bind

method Transducer<E, Sum<X, C>> selectMany <E, X, A, B, C> ( Transducer<E, Sum<X, A>> ma, Func<A, Transducer<E, Sum<X, B>>> bind, Func<A, B, C> project) Source #

Monadic bind

method Transducer<A, B> filter <A, B> (Transducer<A, B> f, Transducer<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, B> filter <A, B> (Transducer<A, B> f, Func<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, Sum<X, B>> filter <X, A, B> (Transducer<A, Sum<X, B>> f, Transducer<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, Sum<X, B>> filter <X, A, B> (Transducer<A, Sum<X, B>> f, Func<B, bool> pred) Source #

Filter the values in the transducer

Parameters

param f

Transducer to filter

param pred

Predicate to apply

returns

Filtered transducer

method Transducer<A, S> fold <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<(S State, A Value), TResult<Unit>> predicate) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldWhile <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<(S State, A Value), bool> predicate) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldWhile <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<A, bool> valueIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldWhile <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<S, bool> stateIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldWhile <S, A> ( S initialState, Func<S, A, S> folder, Func<(S State, A Value), bool> predicate) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldWhile <S, A> ( S initialState, Func<S, A, S> folder, Func<A, bool> valueIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldWhile <S, A> ( S initialState, Func<S, A, S> folder, Func<S, bool> stateIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldUntil <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<(S State, A Value), bool> predicate) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldUntil <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<A, bool> valueIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldUntil <S, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<S, bool> stateIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldUntil <S, A> ( S initialState, Func<S, A, S> folder, Func<(S State, A Value), bool> predicate) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldUntil <S, A> ( S initialState, Func<S, A, S> folder, Func<A, bool> valueIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<A, S> foldUntil <S, A> ( S initialState, Func<S, A, S> folder, Func<S, bool> stateIs) Source #

Fold

Parameters

type S

State type

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<Sum<X, A>, Sum<X, S>> foldSum <S, X, A> ( Schedule schedule, S initialState, Func<S, A, S> folder, Func<(S State, A Value), TResult<Unit>> predicate) Source #

Fold

Parameters

type S

State type

type X

Alternative type for the transducer result (often the error type)

type A

Input value to the fold operation

param schedule

Series of time-spans that dictate the rate of the fold and for how many iterations

param initialState

Initial state for the fold

param folder

Fold function

param predicate

Predicate that decides if the state should be pushed down the stream

returns

Transducer that folds the stream of values

method Transducer<E, Sum<X, B>> choice <E, X, B> (Seq<Transducer<E, Sum<X, B>>> transducers) Source #

Choice transducer

Tries a sequence of transducers until one succeeds (results in a Sum.Right). If the sequence is exhausted then the transducer completes.

Parameters

param transducers

Sequence of transducers

returns

Transducer that encapsulates the choice

method Transducer<E, Sum<X, B>> choice <E, X, B> (params Transducer<E, Sum<X, B>>[] transducers) Source #

Choice transducer

Tries a sequence of transducers until one succeeds (results in a Sum.Right). If the sequence is exhausted then the transducer completes.

Parameters

param transducers

Sequence of transducers

returns

Transducer that encapsulates the choice

method Transducer<A, B> memoStream <A, B> (Transducer<A, B> transducer) Source #

Caches the result of the transducer computation for each value flowing through.

This works within the context of a single Invoke operation, so it only makes sense if you're using the transducer as part of a stream process. This allows each item coming through to have its result cached. So you never repeat the process for each A value.

Parameters

type EqA
type A
type B
param transducer
returns

method Transducer<A, B> memoStream <EqA, A, B> (Transducer<A, B> transducer) Source #

where EqA : Eq<A>

Caches the result of the transducer computation for each value flowing through.

This works within the context of a single Invoke operation, so it only makes sense if you're using the transducer as part of a stream process. This allows each item coming through to have its result cached. So you never repeat the process for each A value.

Parameters

type EqA
type A
type B
param transducer
returns

method Transducer<A, B> memo <A, B> (Transducer<A, B> transducer) Source #

Caches the result of the transducer computation for each value flowing through.

Unlike MemoStream - which only caches values for the duration of the the call to Invoke - this caches values for the duration of the life of the Transducer instance.

NOTE: Transducers use both a value and a state as inputs to its transformation and reduce process. For memoisation the state is ignored. In a non-memoisation scenario a different state and value pair could produce different results; and so this should be considered when deciding to apply a memo to a transducer: it only checks value equality.

Parameters

param transducer

Transducer to memoise

returns

Memoised transducer

method Transducer<A, B> memo <EqA, A, B> (Transducer<A, B> transducer) Source #

where EqA : Eq<A>

Caches the result of the transducer computation for each value flowing through.

Unlike MemoStream - which only caches values for the duration of the the call to Invoke - this caches values for the duration of the life of the Transducer instance.

NOTE: Transducers use both a value and a state as inputs to its transformation and reduce process. For memoisation the state is ignored. In a non-memoisation scenario a different state and value pair could produce different results; and so this should be considered when deciding to apply a memo to a transducer: it only checks value equality.

Parameters

param transducer

Transducer to memoise

returns

Memoised transducer

method Transducer<E, (A First, B Second)> zip <E, A, B> ( Transducer<E, A> First, Transducer<E, B> Second) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

returns

A transducer that contains the results of both provided

method Transducer<E, Sum<X, (A First, B Second)>> zip <E, X, A, B> ( Transducer<E, Sum<X, A>> First, Transducer<E, Sum<X, B>> Second) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

returns

A transducer that contains the results of both provided

method Transducer<E, (A First, B Second, C Third)> zip <E, A, B, C> ( Transducer<E, A> First, Transducer<E, B> Second, Transducer<E, C> Third) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

param Third

Third transducer

returns

A transducer that contains the results of all provided

method Transducer<E, Sum<X, (A First, B Second, C Third)>> zip <E, X, A, B, C> ( Transducer<E, Sum<X, A>> First, Transducer<E, Sum<X, B>> Second, Transducer<E, Sum<X, C>> Third) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

param Third

Third transducer

returns

A transducer that contains the results of all provided

method Transducer<E, (A First, B Second, C Third, D Fourth)> zip <E, A, B, C, D> ( Transducer<E, A> First, Transducer<E, B> Second, Transducer<E, C> Third, Transducer<E, D> Fourth) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

param Third

Third transducer

returns

A transducer that contains the results of all provided

method Transducer<E, Sum<X, (A First, B Second, C Third, D Fourth)>> zip <E, X, A, B, C, D> ( Transducer<E, Sum<X, A>> First, Transducer<E, Sum<X, B>> Second, Transducer<E, Sum<X, C>> Third, Transducer<E, Sum<X, D>> Fourth) Source #

Zips transducers together so their results are combined.

Asynchronous transducers will run concurrently

Parameters

param First

First transducer

param Second

Second transducer

param Third

Third transducer

returns

A transducer that contains the results of all provided

method Transducer<A, TFork<B>> fork <A, B> (Transducer<A, B> transducer, Option<TimeSpan> timeout = default) Source #

Create a transducer that is queued to run on the thread-pool.

Parameters

param transducer

Transducer to fork

param timeout

Maximum time that the forked transducer can run for. None for no timeout.

returns

Returns a TFork data-structure that contains two transducers that can be used to either cancel the forked transducer or to await the result of it.

method Transducer<A, TFork<S>> fork <S, A, B> ( Transducer<A, B> transducer, S initialState, Reducer<B, S> reducer, Option<TimeSpan> timeout = default) Source #

Create a transducer that is queued to run on the thread-pool.

Parameters

param transducer

Transducer to fork

param timeout

Maximum time that the forked transducer can run for. None for no timeout.

returns

Returns a TFork data-structure that contains two transducers that can be used to either cancel the forked transducer or to await the result of it.

method Transducer<A, B> @try <A, B> ( Transducer<A, B> transducer, Func<Error, bool> match, Transducer<Error, B> @catch) Source #

Like try / catch this transducer wraps an existing transducer and catches any errors generated.

The match function is a predicate that decides if the error is going to be dealt with by the catch transducer. If it is then it can make the result safe, or indeed throw a new error if necessary.

Parameters

param transducer

Transducer to wrap with the try

param match

Predicate that decides if the error is going to be dealt with

param catch

Transducer that handles the error

returns

A transducer that is wrapped with a try / catch

method Transducer<RT, Sum<X, A>> @try <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer, Func<X, bool> match, Transducer<X, Sum<X, A>> @catch) Source #

where RT : HasFromError<RT, X>

Like try / catch this transducer wraps an existing transducer and catches any errors generated.

The match function is a predicate that decides if the error is going to be dealt with by the catch transducer. If it is then it can make the result safe, or indeed throw a new error if necessary.

Because the result of the wrapped transducer is a Sum type where Left is considered the failure value. This function will convert any exceptional Error values to Left so they can be matched and caught just like any regular Left value.

Parameters

param transducer

Transducer to wrap with the try

param match

Predicate that decides if the error is going to be dealt with

param catch

Transducer that handles the error

returns

A transducer that is wrapped with a try / catch

method Transducer<A, B> retry <A, B> (Schedule schedule, Transducer<A, B> transducer) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<A, B> retryUntil <A, B> ( Schedule schedule, Transducer<A, B> transducer, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<A, B> retryWhile <A, B> ( Schedule schedule, Transducer<A, B> transducer, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns false then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> retry <RT, X, A> ( Schedule schedule, Transducer<RT, Sum<X, A>> transducer) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> retryUntil <RT, X, A> ( Schedule schedule, Transducer<RT, Sum<X, A>> transducer, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> retryWhile <RT, X, A> ( Schedule schedule, Transducer<RT, Sum<X, A>> transducer, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that retries

method Transducer<A, B> retry <A, B> ( Transducer<A, B> transducer) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<A, B> retryUntil <A, B> ( Transducer<A, B> transducer, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<A, B> retryWhile <A, B> ( Transducer<A, B> transducer, Func<Error, bool> predicate) Source #

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns false then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> retry <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> retryUntil <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each failure. If it returns true then the retying stops and the Error is yielded.

returns

A transducer that retries

method Transducer<RT, Sum<X, A>> retryWhile <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer, Func<X, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep retrying if the transducer fails

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep retrying

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that retries

method Transducer<A, B> repeat <A, B> (Schedule schedule, Transducer<A, B> transducer) Source #

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

returns

A transducer that repeats

returns

A transducer that repeats

method Transducer<A, B> repeatUntil <A, B> ( Schedule schedule, Transducer<A, B> transducer, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> repeatWhile <A, B> ( Schedule schedule, Transducer<A, B> transducer, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> repeat <RT, X, A> ( Schedule schedule, Transducer<RT, Sum<X, A>> transducer) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

returns

A transducer that retries

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> repeatUntil <RT, X, A> ( Schedule schedule, Transducer<RT, Sum<X, A>> transducer, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> repeatWhile <RT, X, A> ( Schedule schedule, Transducer<RT, Sum<X, A>> transducer, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> repeat <A, B> ( Transducer<A, B> transducer) Source #

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

returns

A transducer that repeats

returns

A transducer that repeats

method Transducer<A, B> repeatUntil <A, B> ( Transducer<A, B> transducer, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> repeatWhile <A, B> ( Transducer<A, B> transducer, Func<B, bool> predicate) Source #

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> repeat <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

returns

A transducer that retries

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> repeatUntil <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of retries and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns true then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<RT, Sum<X, A>> repeatWhile <RT, X, A> ( Transducer<RT, Sum<X, A>> transducer, Func<A, bool> predicate) Source #

where RT : HasFromError<RT, X>

Keep repeating the transducer until a condition is met

Parameters

param schedule

Schedule that dictates the number of repeats and the time-gap between each one

param transducer

Transducer to keep repeating

param predicate

Predicate that decides whether to continue on each repeat. If it returns false then the repeating stops and the latest value is yielded.

returns

A transducer that repeats

method Transducer<A, B> post <A, B> (Transducer<A, B> f) Source #

Make a transducer run on the SynchronizationContext that was captured at the start of an Invoke call.

The transducer receives its input value from the currently running sync-context and then proceeds to run its operation in the captured SynchronizationContext: typically a UI context, but could be any captured context. The result of the transducer is the received back on the currently running sync-context.

Parameters

param f

Transducer

returns

method Transducer<A, B> use <A, B> (Transducer<A, B> transducer, Func<B, Unit> dispose) Source #

Resource tracking transducer

method Transducer<A, B> use <A, B> (Transducer<A, B> transducer) Source #

where B : IDisposable

Resource tracking transducer

method Transducer<Unit, A> use <A> (Func<A> acquire, Func<A, Unit> release) Source #

Create a new resource tracking monad: Use. This monad works with other effect based monads that will automatically clean-up the resource when the computation is complete.

Parameters

type A

Bound value type

param acquire

Resource generator

param dispose

Resource disposer

returns

Use monad that works with other effect monads

method Transducer<Unit, A> use <A> (Func<A> acquire, Action<A> release) Source #

Create a new resource tracking monad: Use. This monad works with other effect based monads that will automatically clean-up the resource when the computation is complete.

Parameters

type A

Bound value type

param acquire

Resource generator

param dispose

Resource disposer

returns

Use monad that works with other effect monads

method Transducer<Unit, A> use <A> (Func<A> acquire) Source #

where A : IDisposable

Create a new resource tracking monad: Use. This monad works with other effect based monads that will automatically clean-up the resource when the computation is complete.

Parameters

type A

Bound value type

param acquire

Resource generator

param dispose

Resource disposer

returns

Use monad that works with other effect monads

method Transducer<A, Unit> release <A> () Source #

Create a new Release monad that works with other, effectful, resource tracking monads. The effect of composing this with those other monadic types is that any underlying tracked resource that is equal (through reference equality) will have its resource disposed.

Parameters

type A

Bound value type

param resource

Resource to release

returns

Release monads

method Transducer<Unit, Unit> release <A> (A resource) Source #

Create a new Release monad that works with other, effectful, resource tracking monads. The effect of composing this with those other monadic types is that any underlying tracked resource that is equal (through reference equality) will have its resource disposed.

Parameters

type A

Bound value type

param resource

Resource to release

returns

Release monads

method B use <A, B> (Func<A> generator, Func<A, B> f) Source #

where A : IDisposable

Functional implementation of the using(...) { } pattern

Parameters

param generator

Disposable to use

param f

Inner map function that uses the disposable value

returns

Result of f(generator())

method B use <A, B> (A disposable, Func<A, B> f) Source #

where A : IDisposable

Functional implementation of the using(...) { } pattern

Parameters

param disposable

Disposable to use

param f

Inner map function that uses the disposable value

returns

Result of f(disposable)

record Reducer <A, S> Source #

Reducer is an encapsulation of a fold operation. It also takes a TState which can be used to track resources allocated.

Parameters

type A

Value type

type S

State type

Methods

method TResult<S> Run (TState state, S stateValue, A value) Source #

Run the reduce operation with an initial state and value

class Reducer Source #

Methods

method Reducer<A, S> from <A, S> (Func<TState, S, A, TResult<S>> f) Source #

record Sum <X, A> Source #

Sum-type. Represents either a value of type A or a value of type X.

Isomorphic to Either<L, R>

Parameters

type X

Alternative value type

type A

Value type

Properties

property bool IsLeft Source #

Returns true if the sum-value is in a Left state

property bool IsRight Source #

Returns true if the sum-value is in a Right state

Methods

method Sum<X, A> Left (X value) Source #

Constructor of SumLeft<X, A>

Parameters

param value
returns

Sum<X, A>

method Sum<X, A> Right (A value) Source #

Constructor of SumRight<X, A>

Parameters

param value
returns

Sum<X, A>

method Sum<X, B> Map <B> (Func<A, B> f) Source #

Functor map

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped functor

method Sum<Y, B> BiMap <B, Y> (Func<X, Y> Left, Func<A, B> Right) Source #

Functor bi-map

method Sum<X, B> Bind <B> (Func<A, Sum<X, B>> f) Source #

Monadic bind

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped monad

method Sum<X, C> SelectMany <B, C> (Func<A, Sum<X, B>> bind, Func<A, B, C> project) Source #

Monadic bind and project

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped monad

method Sum<X, B> Cast <B> () Source #

Casts the sum-type's bound value-type. If the sum-type is in a Right state then this will throw

record SumLeft <X, A> (X Value) Source #

Left (alternative) case of the SumType union

Parameters

type X

Alternative value type

type A

Value type

param Value

Value of the case

Properties

property bool IsLeft Source #

Returns true if the sum-value is in a Left state

property bool IsRight Source #

Returns true if the sum-value is in a Right state

Methods

method Sum<X, B> Map <B> (Func<A, B> f) Source #

Functor map

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped functor

method Sum<Y, B> BiMap <B, Y> (Func<X, Y> Left, Func<A, B> Right) Source #

Functor bi-map

method Sum<X, B> Bind <B> (Func<A, Sum<X, B>> f) Source #

Monadic bind

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped monad

method string ToString () Source #

method Sum<X, B> Cast <B> () Source #

record SumRight <X, A> (A Value) Source #

Right (primary) case of the SumType union

Parameters

type X

Alternative value type

type A

Value type

param Value

Value of the case

Properties

property bool IsLeft Source #

Returns true if the sum-value is in a Left state

property bool IsRight Source #

Returns true if the sum-value is in a Right state

Methods

method Sum<X, B> Map <B> (Func<A, B> f) Source #

Functor map

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped functor

method Sum<Y, B> BiMap <B, Y> (Func<X, Y> Left, Func<A, B> Right) Source #

Functor bi-map

method Sum<X, B> Bind <B> (Func<A, Sum<X, B>> f) Source #

Monadic bind

Parameters

type B

Type of the bound value post-mapping

param f

Function that maps the bound value

returns

Mapped monad

method string ToString () Source #

class Sum Source #

Methods

method Fin<A> ToFin <A> (this Sum<Error, A> sum) Source #

Convert a Sum to a Fin

method Either<L, R> ToEither <L, R> (this Sum<L, R> sum) Source #

Convert a Sum to a Fin

method Sum<L, R> Flatten <L, R> (this Sum<L, Sum<L, R>> mma) Source #

record TFork <A> ( Transducer<Unit, Unit> Cancel, Transducer<Unit, A> Await) Source #

Result of forking a transducer

Parameters

type A
param Cancel

A transducer, which if invoked, would cancel the forked transducer

param Await

A transducer, which if invoked, would attempt to get the result of the forked transducer

record Transducer <A, B> Source #

Transducers are composable algorithmic transformations. They are independent from the context of their input and output sources and specify only the essence of the transformation in terms of an individual element. Because transducers are decoupled from input or output sources, they can be used in many different processes - collections, streams, channels, observables, etc. Transducers compose directly, without awareness of input or creation of intermediate aggregates.

Parameters

type A

Input value type

type B

Output value type

Properties

property Transducer<A, B> Morphism Source #

Transducer from A to B

Methods

method Reducer<A, S> Transform <S> (Reducer<B, S> reduce) Source #

Transform the transducer using the reducer provided

Parameters

type S

State type

param reduce

Reducer

returns

Reducer that captures the transformation of the Transducer and the provided reducer

method Transducer<A, C> Compose <C> (Transducer<B, C> next) Source #

Compose this transducer with the one provided

Operators

operator | (A prev, Transducer<A, B> next) Source #

operator | (Transducer<A, B> prev, Transducer<B, B> next) Source #

operator | (Transducer<A, A> prev, Transducer<A, B> next) Source #

record TResultBase Source #

Properties

property Error ErrorUnsafe Source #

property bool Success Source #

property bool Continue Source #

property bool Faulted Source #

property bool Recursive Source #

record TResult <A> Source #

Properties

property A ValueUnsafe Source #

Methods

method TResult<S> Reduce <S> (TState state, S stateValue, Reducer<A, S> reducer) Source #

method TResult<B> Map <B> (Func<A, B> f) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> f) Source #

record TContinue <A> (A Value) Source #

Properties

property bool Success Source #

property bool Continue Source #

property bool Faulted Source #

property bool Recursive Source #

property A ValueUnsafe Source #

Methods

method TResult<B> Map <B> (Func<A, B> f) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> f) Source #

method TResult<S> Reduce <S> (TState state, S stateValue, Reducer<A, S> reducer) Source #

method string ToString () Source #

record TComplete <A> (A Value) Source #

Properties

property bool Success Source #

property bool Continue Source #

property bool Faulted Source #

property bool Recursive Source #

property A ValueUnsafe Source #

Methods

method TResult<B> Map <B> (Func<A, B> f) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> f) Source #

method TResult<S> Reduce <S> (TState state, S stateValue, Reducer<A, S> reducer) Source #

method string ToString () Source #

record TCancelled <A> Source #

Fields

Properties

property bool Success Source #

property bool Continue Source #

property bool Faulted Source #

property bool Recursive Source #

property Error ErrorUnsafe Source #

Methods

method TResult<B> Map <B> (Func<A, B> _) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> _) Source #

method TResult<S> Reduce <S> (TState state, S stateValue, Reducer<A, S> reducer) Source #

method string ToString () Source #

record TNone <A> Source #

Fields

Properties

property bool Success Source #

property bool Continue Source #

property bool Recursive Source #

property bool Faulted Source #

Methods

method TResult<B> Map <B> (Func<A, B> _) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> _) Source #

method TResult<S> Reduce <S> (TState state, S stateValue, Reducer<A, S> reducer) Source #

method string ToString () Source #

record TFail <A> (Error Error) Source #

Properties

property bool Success Source #

property bool Continue Source #

property bool Faulted Source #

property bool Recursive Source #

property Error ErrorUnsafe Source #

Methods

method TResult<B> Map <B> (Func<A, B> _) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> _) Source #

method TResult<S> Reduce <S> (TState state, S stateValue, Reducer<A, S> reducer) Source #

method string ToString () Source #

record TRecursive <A> (TRecursiveRunner<A> Runner) Source #

Properties

property bool Success Source #

property bool Continue Source #

property bool Faulted Source #

property bool Recursive Source #

Methods

method TResult<B> Map <B> (Func<A, B> f) Source #

method TResult<B> Bind <B> (Func<A, TResult<B>> f) Source #

method TResult<A> Run () Source #

method TResult<S> Reduce <S> (TState st, S s, Reducer<A, S> r) Source #

method string ToString () Source #

record TRecursiveRunner <A> Source #

Methods

method TResult<A> Run () Source #

method TRecursiveRunner<B> Map <B> (Func<A, B> f) Source #

method TRecursiveRunner<B> Bind <B> (Func<A, TResult<B>> f) Source #

record TRecursiveReduce <A, S> (TState State, S StateValue, A Value, Reducer<A, S> Next) Source #

Methods

method TResult<S> Run () Source #

record TRecursiveMap <A, B> (TRecursiveRunner<A> Next, Func<A, B> F) Source #

Methods

method TResult<B> Run () Source #

record TRecursiveBind <A, B> (TRecursiveRunner<A> Next, Func<A, TResult<B>> F) Source #

Methods

method TResult<B> Run () Source #

class TResult Source #

Methods

method TResult<A> Continue <A> (A value) Source #

method TResult<A> Complete <A> (A value) Source #

method TResult<A> Cancel <A> () Source #

method TResult<A> None <A> () Source #

method TResult<A> Fail <A> (Error Error) Source #

method TResult<S> Recursive <S, A> (TState st, S s, A value, Reducer<A, S> reduce) Source #

method TResult<S> Recursive <S> (TRecursiveRunner<S> reduce) Source #

method Fin<A> ToFin <A> (this TResult<A> ma) Source #

method Fin<A> ToFin <A> (this TResult<Sum<Error, A>> ma) Source #

method Either<E, A> ToEither <E, A> (this TResult<Sum<E, A>> ma, Func<Error, Either<E, A>> errorMap) Source #

class TState Source #

Fields

field CancellationToken Token = token Source #

field SynchronizationContext? SynchronizationContext = syncContext Source #

Constructors

constructor TState (SynchronizationContext? syncContext, CancellationToken token) Source #

Methods

method Unit Using <A> (A value, Func<A, Unit> dispose) Source #

method Unit Using <A> (A value) Source #

where A : IDisposable

method Unit Release <A> (A value) Source #

method void Dispose () Source #